package student.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import student.aistar.model.entity.Navclass;
import student.aistar.model.entity.Parameters;
import student.aistar.service.IIndexService;
import student.aistar.service.IProductParameterService;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/productparameter")
public class ProductParameterController {
    //控制层调用service层
    @Autowired
    private IProductParameterService iProductParameterService;
    @Autowired
    private IIndexService iIndexService;

    @GetMapping("/index")
    public String index(Model model){
        List<Navclass> navClassList = iIndexService.navClassList();
        model.addAttribute("navClassList", navClassList);
        List<Parameters> productParameterList = iProductParameterService.getAll();
        //放入到request作用域
        model.addAttribute("pro",productParameterList);
        //转发
        return "productparameter/index";
    }

}
